using System.Drawing;
using System.Text;
using System.Web;
using Kaleida.ServiceMonitor.Model.Email;

namespace Kaleida.ServiceMonitor.Model.Runtime
{
    public static class MonitorStateExtensions
    {
        public static IHtmlString ToSummaryHtml(this Color colour)
        {
            var htmlColour = colour.ToHtml();

            var html = new StringBuilder();
            html.AppendFormat("<span style='padding:4px; background-color: {0};'>", htmlColour);
            html.Append(colour.Name);
            html.Append("</span>");
            return html.ToString().AsRawHtml();
        }

        internal static string ToHtml(this Color colour)
        {
            return ColorTranslator.ToHtml(colour);
        }
    }
}